import type { ReactNode } from 'react'
import type { MaskProps } from '../Mask'
import type { ImperativeHandler } from '../../utils/render-imperatively'

export type ToastProps = {
  /** 显示内容. default: - */
  content?: ReactNode
  /** 提示持续时间，若为 0 则不会自动关闭. default: `2000ms` */
  duration?: number
  /** Toast 图标. default: - */
  icon?: 'success' | 'fail' | 'warning' | 'loading' | ReactNode
  /** 背景是否可点击. default: false */
  maskClickable?: boolean,
  /** Toast 遮罩样式. default: - */
  maskStyle?: MaskProps['style']
  /** Toast 遮罩类名. default: - */
  maskClassName?: string
  /** 垂直方向显示位置. default: `center` */
  position?: 'top' | 'bottom' | 'center'
} & Pick<
  MaskProps,
  /** default: - */
  | 'afterClose'
  /** default: `['click']` */
  | 'stopPropagation'
  /** default: - */
  | 'visible'
  /** default: null */
  | 'getContainer'
>

export type ToastConfigProps = Pick<ToastProps, 'duration' | 'position' | 'maskClickable'>

export type ToastShowProps = Omit<ToastProps, 'visible'>

export type ToastHandler = Pick<ImperativeHandler, 'close'>
